package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Message;
import cn.wolfcode.trip.base.query.LetterQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MessageMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Message record);

    Message selectByPrimaryKey(Long id);

    List<Message> selectAll();

    int updateByPrimaryKey(Message record);

    Integer selectForCountByUserId(Long userId);

    //跟新当前用户的私信状态
    void updateLetterState(@Param("isnew") int isnew, @Param("userId")Long userId);

    void insertRelation(@Param("reciverId") Long reciverId, @Param("msgId") Long msgId);

    List<Message> selectMyRecivedLetters(LetterQuery qo);

    List<Message> selectSentLettersForPage(LetterQuery qo);

    void deleteRelation(@Param("msgId") Long msgId,@Param("userId") Long userId);

    void updateMyLettersValidById(Long id);

    void updateRecivedLettersValidById(Long id);

    void updateRecivedLetterValidByUserId(Long userId);

    void updateMyLetterValidByUserId(Long userId);
}